<?php

class Main extends Controller {

    function Main() {
        parent::Controller();

        $this->load->library('session');
        $this->load->model('Auth');
        $ckeck = $this->Auth->login($this->session->userdata('login'));
        if ($this->session->userdata('hash') != '' && $ckeck->Hash == $this->session->userdata('hash'))
            return;
        if ($this->uri->segment(2) === 'login')
            return;
        redirect('autorize/login');
    }

    function index() {
         $this->load->model('Users_model','Users');
        $this->load->view('header');
        $this->load->view('menu');
        $data['info'] = $this->Users->showInfo();
        $data['tasks'] = $this->Users->getTasks();
        $this->load->view('index',$data);
        $this->load->view('footer');
    }

}

